package com.zfei.gfb.device.web.filter;

import com.zfei.gfb.api.UserService;
import com.zfei.gfb.device.web.WebAdvisor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author fgh
 */
@Component
@Aspect
public class Advisor extends WebAdvisor {

    @Resource
    private UserService userService;

    @Pointcut("within(com.zfei.gfb.controller..*) && @annotation(com.zfei.gfb.core.HttpJson)")
    public void httpJson() {
    }

    @Around("httpJson()")
    public Object doHttpJson(ProceedingJoinPoint jp) throws Throwable {
        return around(jp);
    }

    @Override
    protected UserService getUserService() {
        return userService;
    }
}
